package edu.hit.RESP;

import java.util.List;

public class ArrayString <T extends RespData> implements RespData{

    private List<T> value;

    public ArrayString(List<T> value) {
        this.value = value;
    }

    @Override
    public List<T> getValue() {
        return value;
    }

    public T getFirstValue(){return value.getFirst();}

    @Override
    public String convert() {
        StringBuilder builder =
                new StringBuilder("*").append(this.value.size()).append("\r\n");
        for (RespData respData: this.value) {
            builder.append(respData.convert());
        }
        return builder.toString();
    }

    @Override
    public String getType() {
        return "ArrayBulkString";
    }
}
